package com.hm.cms.auto.su;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * @author shishun.wang
 * @date 2017年10月28日 上午10:37:58
 * @version 1.0
 * @describe
 */
public class BaseInterceptor extends HandlerInterceptorAdapter {

	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		String scheme = request.getScheme();
		String serverName = request.getServerName();
		int port = request.getServerPort();
		String path = request.getContextPath();
		String basePath = scheme + "://" + serverName + ":" + port + path;
		// log.info(basePath);
		request.setAttribute("basePath", basePath);
		return true;
	}
}
